#include <iostream>
#include <vector>
#include <math.h>
#include <limits.h>
using namespace std;
/**
 * @brief
 * 1 <= area <= 107
 *
 */
class Solution
{
public:
    vector<int> constructRectangle(int area)
    {
        int diff = area;
        int L = area, W = 1;
        // L>=W sqrt
        for (int i = 1; i <= sqrt(area); i++)
        {
            if (area % i == 0)
            {
                L = area / i, W = i;
                if (abs(L - W) < diff)
                {
                    diff = abs(L - W);
                }
            }
        }
        return {L, W};
    }

    vector<int> constructRectangle_2(int area)
    {
        vector<int> ans(2);
        int v = sqrt(area);
        while (1)
        {
            if (area % v == 0)
            {
                ans[0] = area / v;
                ans[1] = v;
                return ans;
            }
            else
            {
                v--;
            }
        }
        return ans;
    }
};
int main()
{
    Solution s;
    vector<int> ans = s.constructRectangle(122122);
    for (int a : ans)
    {
        cout << a << " ";
    }
    cout << endl;
    return 0;
}
